using SqlSugar;
using IM.Easy.Core.Audit;

namespace IM.Easy.Entity.Log
{
    /// <summary>
    /// 用户在线日志表
    /// </summary>
    [SugarTable("UserOnlineLog")]
    public class UserOnlineLog : ICreated
    {
        /// <summary>
        /// 日志唯一ID
        /// </summary>
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]

        public Guid Id { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [SugarColumn(ColumnName = "UserId")]
        public string UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [SugarColumn(ColumnName = "UserName", Length = 50)]
        public string? UserName { get; set; }

        /// <summary>
        /// 上线时间
        /// </summary>
        [SugarColumn(ColumnName = "OnlineTime")]
        public DateTime OnlineTime { get; set; }

        /// <summary>
        /// 下线时间
        /// </summary>
        [SugarColumn(ColumnName = "OfflineTime")]
        public DateTime? OfflineTime { get; set; }

        /// <summary>
        /// 用户IP地址
        /// </summary>
        [SugarColumn(ColumnName = "IpAddress")]
        public string? IpAddress { get; set; }

        /// <summary>
        /// 客户端IP
        /// </summary>
        [SugarColumn(ColumnName = "ClientIP")]
        public string? ClientIP { get; set; }

        /// <summary>
        /// 用户代理信息（如浏览器类型、版本等）
        /// </summary>
        [SugarColumn(ColumnName = "UserAgent")]
        public string? UserAgent { get; set; }

        /// <summary>
        /// 用户终端信息
        /// </summary>
        [SugarColumn(ColumnName = "TerminalInfo")]
        public string? TerminalInfo { get; set; }

        /// <summary>
        /// 请求的唯一追踪ID
        /// </summary>
        [SugarColumn(ColumnName = "ConnectionId")]
        public string ConnectionId { get; set; }

        /// <summary>
        /// 操作描述或备注
        /// </summary>
        [SugarColumn(ColumnName = "Description", ColumnDataType = StaticConfig.CodeFirst_BigString)]
        public string? Description { get; set; }

        /// <summary>
        /// 记录创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CreatedAt")]
        public DateTime? CreatedAt { get; set; }


        [SugarColumn(ColumnName = "CreatedBy")]

        public long CreatedBy { get; set; }
    }
}
